package com.hxkj.controller;

import com.github.pagehelper.PageInfo;
import com.hxkj.domain.po.SystemMessageReceive;
import com.hxkj.service.SystemMessageReceiveService;
import com.platform.common.domain.to.PageTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.Callable;

@RestController
@RequestMapping(value = "/systemMessageReceive")
public class SystemMessageReceiveController {

    @Autowired
    private SystemMessageReceiveService smrService;

    @RequestMapping(value = "/getList")
    public Callable<PageInfo<SystemMessageReceive>> getList(@ModelAttribute SystemMessageReceive systemMessageReceive,
                                                            @ModelAttribute PageTo pageParams, HttpServletRequest request) throws Exception{
        return () -> smrService.getList(systemMessageReceive, pageParams, request);
    }

    @RequestMapping(value = "/getMessageInfo")
    public Callable<SystemMessageReceive> getMessageInfo(SystemMessageReceive systemMessageReceive) throws Exception{
        return () -> smrService.getMessageInfo(systemMessageReceive);
    }

    @RequestMapping(value = "/deleteSysMsg")
    public void deleteSysMsg(String ids) throws Exception{
        smrService.deleteSysMsg(ids);
    }

    @RequestMapping(value = "/updateMsgReadStatus")
    public void updateMsgReadStatus(String ids) throws Exception{
        smrService.updateMsgReadStatus(ids);
    }
}
